/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package comandaXM.vista.manteniment.proveidor;

import comandaXM.accions.AuxiliarsAct;
import comandaXM.accions.ProveidorsAct;
import comandaXM.classes.manteniment.auxiliar.*;
import comandaXM.classes.manteniment.proveidor.*;
import comandaXM.excepcions.ExceptionHibernate;
import comandaXM.utils.ComboBoxModelXM;
import comandaXM.utils.JLabelXM;
import comandaXM.utils.JOPtionPaneXM;
import comandaXM.utils.JTextCompleterXM;
import comandaXM.utils.TDSLanguageUtils;
import comandaXM.utils.Utils;
import comandaXM.utils.ValidarText;
import comandaXM.classes.informes.Dtproveidors;
import java.awt.Color;
import java.awt.KeyboardFocusManager;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JLabel;
import javax.swing.JTextField;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;

/**
 *
 * @author xmarti
 */
public class JPProveidor extends javax.swing.JPanel {
    private Proveidor proveidorActual = new Proveidor(); 
    private JPCentres centres;
    private JPContactes contactes; 
    private JPNotificacions notificacions; 
    //private Notificacio notificacioActual= new Notificacio();
    private AuxiliarsAct auxiliarAct= new AuxiliarsAct(); 
    private ProveidorsAct proveidorAct= new ProveidorsAct(); 
    private JTextCompleterXM autoCompleterProvincia; 
    private JTextCompleterXM autoCompleterPais; 
    private List<Proveidor> proveidors = new ArrayList<Proveidor>();
    //private boolean isInsert=false; 
    private int accio=0 ; 
    private JOPtionPaneXM optionPane= new  JOPtionPaneXM(); 
    public JPProveidor() {
        initComponents();
        setComponents(); 
    }
    private void setComponents(){
        
            //this.jLabelCIF = new JLabelXM(); 
            
            this.pProveidor.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,Utils.forwardKeys());
            
            this.txtProvincia.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,Utils.forwardKeyTab());
            this.txtPais.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,Utils.forwardKeyTab());
            
            this.pProveidor.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,Utils.backwardKeys());
            this.txtProvincia.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,Utils.backwardKeyTab());
            this.txtPais.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,Utils.backwardKeyTab());
            this.pDadesComptables.setFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS,Utils.forwardKeys());
            this.pDadesComptables.setFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS,Utils.backwardKeys());
            this.pCentre.setFocusable(false);
            this.pNotificacio.setFocusable(false);
            
            this.txtNif.setDocument(new ValidarText(12,false));
            this.txtCodiPostal.setDocument(new ValidarText(5,true));
            this.txtCodi.setDocument(new ValidarText(6,true));
            this.txtIban1.setDocument( new ValidarText(4,false,true));
            this.txtIban2.setDocument( new ValidarText(4,true));
            this.txtIban3.setDocument( new ValidarText(4,true));
            this.txtIban4.setDocument( new ValidarText(4,true));
            this.txtIban5.setDocument( new ValidarText(4,true));
            this.txtIban6.setDocument( new ValidarText(4,true));            
            this.setTipusIva();
            this.setTipusPagament();
            this.tbCercar.setSelected(true);
            this.setAction();      
            this.resetControls();
        try {
            this.autoCompleterProvincia= new JTextCompleterXM(this.txtProvincia,auxiliarAct.getProvincies());
            this.autoCompleterPais= new JTextCompleterXM(this.txtPais,auxiliarAct.getPaisos());
            this.activarCercador();
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }
    } 
    
//    public List<Proveidor> getProveidors () throws ExceptionHibernate{
//        return proveidorAct.getProveidors(this.txtNif.getText(), this.txtNomFiscal.getText(), this.txtNomComercial.getText(), this.txtDireccio.getText(), this.txtPoblacio.getText(), this.txtCodi.getText()); 
//    }
    public void setProvincies() {
        Provincia provincia= (Provincia)this.autoCompleterProvincia.getSelectedItem();
        try {             
            this.autoCompleterProvincia= new JTextCompleterXM(this.txtProvincia,auxiliarAct.getProvincies());
            this.autoCompleterProvincia.setSelectedItem(provincia);
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }
    }
    public void setPaisos() {
        Pais pais= (Pais)this.autoCompleterPais.getSelectedItem();
        try {             
            this.autoCompleterPais= new JTextCompleterXM(this.txtPais,auxiliarAct.getPaisos());
            this.autoCompleterPais.setSelectedItem(pais);
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }
    }  
    public void setTipusPagament() {
        TipusPagament tiTemp= (TipusPagament) cbIva.getSelectedItem(); 
        try {
            this.cbTipusPagament.setModel(new ComboBoxModelXM(auxiliarAct.getTipusPagamentActive())); 
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }
        if (tiTemp instanceof TipusPagament){
            this.cbTipusPagament.setSelectedItem(tiTemp);
        } 
    }
    public void setTipusIva() {        
        TipusIva tiTemp= (TipusIva) cbIva.getSelectedItem(); 
        try {
            cbIva.setModel(new ComboBoxModelXM(auxiliarAct.getTipusIvaActive()));
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }
        if (tiTemp instanceof TipusIva){
            cbIva.setSelectedItem(tiTemp);
        } 
        
    }
    
    private void setProveidor() {
        //TODO CAL TENIR EN COMPTE DE GUARDAR, NO ES POT  GUARDAR EL CODI. 
        this.lblDataAlta.setText(Utils.getStringDate(this.proveidorActual.getDataAlta()));
        this.lblDataBaixa.setText(Utils.getStringDate(this.proveidorActual.getDataBaixa()));
        this.txtCodi.setText( String.valueOf(proveidorActual.getId()));
        this.txtNif.setText(proveidorActual.getCif());
        this.txtNomFiscal.setText(proveidorActual.getNomFiscal());
        this.txtNomComercial.setText(proveidorActual.getNomComercial());
        this.txtDireccio.setText(proveidorActual.getAdressaFiscal());
        this.txtPoblacio.setText(proveidorActual.getPoblacio());
        this.autoCompleterProvincia.setSelectedItem(proveidorActual.getProvincia());
        this.autoCompleterPais.setSelectedItem(proveidorActual.getPais());
        this.txtCodiPostal.setText(proveidorActual.getCodiPostal());
        this.txtElectronica.setText(proveidorActual.getAdressaElectronica());
        this.cbIva.setSelectedItem(proveidorActual.getTipusIva());
        this.cbTipusPagament.setSelectedItem(proveidorActual.getPagament());
        this.txtIban1.setText(proveidorActual.getIban1());
        this.txtIban2.setText(proveidorActual.getIban2());
        this.txtIban3.setText(proveidorActual.getIban3());
        this.txtIban4.setText(proveidorActual.getIban4());
        this.txtIban5.setText(proveidorActual.getIban5());
        this.txtIban6.setText(proveidorActual.getIban6());
        setCentres();
        setNotificacions(); 
        if (this.proveidorActual.isActiu()){
            this.lblEstat.setText("ACTIU");
            this.cmdEstat.setText("BLOQUEJAR");
            
        }else{
            this.lblEstat.setText("NO ACTIU");
            this.cmdEstat.setText("ACTIVAR");
            
        }
    }
    private void setCentres(){
        try {
            
            this.centres= new JPCentres(proveidorActual) {
                @Override
                public void selectContactes() {
                    setContactes(); 
                }
                
            };        
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }                
        this.spCentres.setViewportView(this.centres);
        this.centres.setSize(this.spCentres.getHeight(), this.spCentres.getWidth());
        setContactes(); 
    }
    private void setContactes(){                
        try {            
            this.contactes= new JPContactes((CentreProveidor)centres.getObject());
            
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }        
        this.spContactes.setViewportView(this.contactes);
        this.centres.setSize(this.spContactes.getHeight(), this.spContactes.getWidth());
    }
    private void setNotificacions(){
        try {            
            this.notificacions= new JPNotificacions(proveidorActual) {};
        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }        
        this.spNotificacions.setViewportView(this.notificacions);
        this.notificacions.setSize(this.spNotificacions.getHeight(), this.spNotificacions.getWidth());
    }
    
    private void getProveidor() {        
        this.proveidorActual.setCif(this.txtNif.getText());
        this.proveidorActual.setNomFiscal(this.txtNomFiscal.getText());
        this.proveidorActual.setNomComercial(this.txtNomComercial.getText());
        this.proveidorActual.setAdressaFiscal(this.txtDireccio.getText());
        this.proveidorActual.setPoblacio(this.txtPoblacio.getText());
        this.proveidorActual.setCodiPostal(this.txtCodiPostal.getText());
        this.proveidorActual.setPais((Pais)this.autoCompleterPais.getSelectedItem()); 
        this.proveidorActual.setProvincia((Provincia)this.autoCompleterProvincia.getSelectedItem()); 
        this.proveidorActual.setAdressaElectronica(this.txtElectronica.getText());
        this.proveidorActual.setTipusIva((TipusIva)this.cbIva.getSelectedItem());
        this.proveidorActual.setPagament((TipusPagament)this.cbTipusPagament.getSelectedItem());
        this.proveidorActual.setIban1(this.txtIban1.getText());
        this.proveidorActual.setIban2(this.txtIban2.getText());
        this.proveidorActual.setIban3(this.txtIban3.getText());
        this.proveidorActual.setIban4(this.txtIban4.getText());
        this.proveidorActual.setIban5(this.txtIban5.getText());
        this.proveidorActual.setIban6(this.txtIban6.getText());
    }
    private void resetControls (){               
        ((JLabelXM)this.jLabelCIF).setTexte(TDSLanguageUtils.getMessage("jpProveidor.lblCif.setText"));
        ((JLabelXM)this.jLabelNomFiscal).setTexte(TDSLanguageUtils.getMessage("jpProveidor.lblNomFiscal.setText"));
        ((JLabelXM)this.jLabelCodiPostal).setTexte(TDSLanguageUtils.getMessage("jpProveidor.lblCodiFiscal.setText"));
        ((JLabelXM)this.jLabelDireccio).setTexte(TDSLanguageUtils.getMessage("jpProveidor.lblDireccio.setText"));
        ((JLabelXM)this.jLabelPoblacio).setTexte(TDSLanguageUtils.getMessage("jpProveidor.lblPoblacio.setText"));
        ((JLabelXM)this.jLabelProvincia).setTexte(TDSLanguageUtils.getMessage("jpProveidor.lblProvincia.setText"));
        ((JLabelXM)this.jLabelPais).setTexte(TDSLanguageUtils.getMessage("jpProveidor.lblPais.setText"));        
    }
    private void setFiltres(){
        ((JLabelXM)this.jLabelCIF).setFiltre(this.txtNif.getText());
        ((JLabelXM)this.jLabelNomFiscal).setFiltre(this.txtNomFiscal.getText());
        ((JLabelXM)this.jLabelCodiPostal).setFiltre(this.txtCodiPostal.getText());
        ((JLabelXM)this.jLabelDireccio).setFiltre(this.txtDireccio.getText());
        ((JLabelXM)this.jLabelPoblacio).setFiltre(this.txtPoblacio.getText());
        ((JLabelXM)this.jLabelProvincia).setFiltre(this.txtProvincia.getText());
        ((JLabelXM)this.jLabelPais).setFiltre(this.txtPais.getText());        
    }
    private boolean setErrors() {
        boolean estat=false; 
        if(this.txtNif.getText().length()==0){
            ((JLabelXM)this.jLabelCIF).setError(TDSLanguageUtils.getMessage("obligatori")) ;
            estat=true; 
        }else{
            ((JLabelXM)this.jLabelCIF).setError("") ;
        };
        if(this.txtNomFiscal.getText().length()==0){
            ((JLabelXM)this.jLabelNomFiscal).setError(TDSLanguageUtils.getMessage("obligatori")) ;
            estat=true;
        }else{
            ((JLabelXM)this.jLabelNomFiscal).setError("") ;
        };
        if(this.txtCodiPostal.getText().length()==0){
            ((JLabelXM)this.jLabelCodiPostal).setError(TDSLanguageUtils.getMessage("obligatori")) ;
            estat=true;
        }else{
            ((JLabelXM)this.jLabelCodiPostal).setError("") ;
        };
        if(this.txtDireccio.getText().length()==0){
            ((JLabelXM)this.jLabelDireccio).setError(TDSLanguageUtils.getMessage("obligatori")) ;
            estat=true; 
        }else{
            ((JLabelXM)this.jLabelDireccio).setError("") ;
        };
        if(this.txtPoblacio.getText().length()==0){
            ((JLabelXM)this.jLabelPoblacio).setError(TDSLanguageUtils.getMessage("obligatori")) ;
            estat=true; 
        }else{
            ((JLabelXM)this.jLabelPoblacio).setError("") ;
        };
        if(this.autoCompleterProvincia.getSelectedItem().equals(null)){
            ((JLabelXM)this.jLabelProvincia).setError(TDSLanguageUtils.getMessage("obligatori")) ;
            estat=true; 
        }else{
            ((JLabelXM)this.jLabelProvincia).setError("") ;
        };
        if(this.autoCompleterPais.getSelectedItem().equals(null)){
            ((JLabelXM)this.jLabelPais).setError(TDSLanguageUtils.getMessage("obligatori")) ;
            estat=true; 
        }else{
            ((JLabelXM)this.jLabelPais).setError("") ;
        };
        return estat; 
    }
    
   
    private int   setValidateJText(JTextField t, JLabel l ) {
        int estat=0; 
        if (t.getText().length()== 0)  {
            t.setBorder(Utils.setBorderError());
            l.setVisible(true );
            estat=1; 
        }else{
            t.setBorder(Utils.setBorderOk());
            l.setVisible(false);
            estat= 0; 
        }
        return estat; 
    }
    
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        pProveidor = new javax.swing.JPanel();
        lblDataAlta = new javax.swing.JLabel();
        jLabelPais = new JLabelXM();
        jLabelCodiPostal = new JLabelXM();
        jLabelProvincia = new JLabelXM();
        txtPoblacio = new javax.swing.JTextField();
        txtCodiPostal = new javax.swing.JTextField();
        txtDireccio = new javax.swing.JTextField();
        jLabelPoblacio = new JLabelXM();
        txtCodi = new javax.swing.JTextField();
        lblDataTitol = new javax.swing.JLabel();
        lblCodi = new JLabelXM();
        jLabelDireccio = new JLabelXM();
        txtNif = new javax.swing.JTextField();
        jLabelCIF = new JLabelXM();
        txtNomFiscal = new javax.swing.JTextField();
        jLabelNomComercial = new JLabelXM();
        jLabelNomFiscal = new JLabelXM();
        txtNomComercial = new javax.swing.JTextField();
        txtPais = new javax.swing.JTextField();
        txtProvincia = new javax.swing.JTextField();
        lblDataBaixa = new javax.swing.JLabel();
        lblDataBaixaTitol = new javax.swing.JLabel();
        jLabelElectronica = new javax.swing.JLabel();
        txtElectronica = new javax.swing.JTextField();
        cmdPrimer2 = new javax.swing.JButton();
        pDadesComptables = new javax.swing.JPanel();
        jLabelTipusIva = new javax.swing.JLabel();
        cbIva = new javax.swing.JComboBox();
        jLabelPagament = new javax.swing.JLabel();
        cbTipusPagament = new javax.swing.JComboBox();
        txtIban2 = new javax.swing.JTextField();
        txtIban3 = new javax.swing.JTextField();
        txtIban4 = new javax.swing.JTextField();
        txtIban5 = new javax.swing.JTextField();
        jLabelIban = new javax.swing.JLabel();
        txtIban1 = new javax.swing.JTextField();
        txtIban6 = new javax.swing.JTextField();
        pNotificacio = new javax.swing.JPanel();
        spNotificacions = new javax.swing.JScrollPane();
        pCentre = new javax.swing.JPanel();
        spCentres = new javax.swing.JScrollPane();
        spContactes = new javax.swing.JScrollPane();
        pMenu = new javax.swing.JPanel();
        tbNou = new javax.swing.JToggleButton();
        tbEditar = new javax.swing.JToggleButton();
        cmdGuardar = new javax.swing.JButton();
        cmdEliminar = new javax.swing.JButton();
        cmdPrimer = new javax.swing.JButton();
        cmdAnterior = new javax.swing.JButton();
        cbIndex = new javax.swing.JComboBox();
        cmdUltim = new javax.swing.JButton();
        cmdSeguent = new javax.swing.JButton();
        cmdFiltrar = new javax.swing.JButton();
        tbCercar = new javax.swing.JToggleButton();
        pEstatProveidor = new javax.swing.JPanel();
        lblEstat = new javax.swing.JLabel();
        cmdEstat = new javax.swing.JButton();
        lblCaptionEstat = new javax.swing.JLabel();
        cmdImprimirTots = new javax.swing.JButton();
        pEstat = new javax.swing.JPanel();
        lblAccio = new javax.swing.JLabel();
        lblObjecte = new javax.swing.JLabel();
        lblError = new javax.swing.JLabel();

        pProveidor.setBackground(new java.awt.Color(255, 255, 166));
        pProveidor.setBorder(javax.swing.BorderFactory.createTitledBorder(TDSLanguageUtils.getMessage("jpProveidor.PanelProveidor.setText")));

        lblDataAlta.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
        lblDataAlta.setForeground(java.awt.SystemColor.activeCaption);
        lblDataAlta.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lblDataAlta.setText("15/02/2014");

        jLabelPais.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelPais.setText("PAÍS:");
        jLabelPais.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        jLabelCodiPostal.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelCodiPostal.setText("CODI POSTAL:");
        jLabelCodiPostal.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        jLabelProvincia.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelProvincia.setText("PROVINCIA:");
        jLabelProvincia.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        txtPoblacio.setBackground(new java.awt.Color(255, 255, 204));
        txtPoblacio.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtPoblacio.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtPoblacio.setMinimumSize(new java.awt.Dimension(0, 30));
        txtPoblacio.setPreferredSize(new java.awt.Dimension(0, 30));

        txtCodiPostal.setBackground(new java.awt.Color(255, 255, 204));
        txtCodiPostal.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtCodiPostal.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtCodiPostal.setMinimumSize(new java.awt.Dimension(0, 30));
        txtCodiPostal.setPreferredSize(new java.awt.Dimension(0, 30));

        txtDireccio.setBackground(new java.awt.Color(255, 255, 204));
        txtDireccio.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtDireccio.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtDireccio.setMinimumSize(new java.awt.Dimension(0, 30));
        txtDireccio.setPreferredSize(new java.awt.Dimension(0, 30));

        jLabelPoblacio.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelPoblacio.setText("POBLACIO:");
        jLabelPoblacio.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        txtCodi.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtCodi.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtCodi.setMinimumSize(new java.awt.Dimension(0, 30));
        txtCodi.setPreferredSize(new java.awt.Dimension(0, 30));

        lblDataTitol.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblDataTitol.setText(TDSLanguageUtils.getMessage("jpProveidor.lblDataAlta.setText"));

        lblCodi.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lblCodi.setText(TDSLanguageUtils.getMessage("jpProveidor.lblCodi.setText"));

        jLabelDireccio.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelDireccio.setText("ADREÇA FISCAL:");
        jLabelDireccio.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        txtNif.setBackground(new java.awt.Color(255, 255, 204));
        txtNif.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtNif.setMinimumSize(new java.awt.Dimension(0, 30));
        txtNif.setPreferredSize(new java.awt.Dimension(0, 30));

        jLabelCIF.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelCIF.setText("NIF/CIF:");

        txtNomFiscal.setBackground(new java.awt.Color(255, 255, 204));
        txtNomFiscal.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtNomFiscal.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtNomFiscal.setMinimumSize(new java.awt.Dimension(0, 30));
        txtNomFiscal.setPreferredSize(new java.awt.Dimension(0, 30));
        txtNomFiscal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                txtNomFiscalActionPerformed(evt);
            }
        });

        jLabelNomComercial.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelNomComercial.setText(TDSLanguageUtils.getMessage("jpProveidor.lblNomComercial.setText"));
        jLabelNomComercial.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        jLabelNomFiscal.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelNomFiscal.setText("NOM FISCAL: (Filtre=\"act%\", Error=camp obligatori)");
        jLabelNomFiscal.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        txtNomComercial.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtNomComercial.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtNomComercial.setMinimumSize(new java.awt.Dimension(0, 30));
        txtNomComercial.setPreferredSize(new java.awt.Dimension(0, 30));

        txtPais.setBackground(new java.awt.Color(255, 255, 204));
        txtPais.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtPais.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtPais.setMinimumSize(new java.awt.Dimension(0, 30));
        txtPais.setPreferredSize(new java.awt.Dimension(0, 30));

        txtProvincia.setBackground(new java.awt.Color(255, 255, 204));
        txtProvincia.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtProvincia.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtProvincia.setMinimumSize(new java.awt.Dimension(0, 30));
        txtProvincia.setPreferredSize(new java.awt.Dimension(0, 30));

        lblDataBaixa.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
        lblDataBaixa.setForeground(javax.swing.UIManager.getDefaults().getColor("nb.errorForeground"));
        lblDataBaixa.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        lblDataBaixa.setText("15/02/2014");

        lblDataBaixaTitol.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblDataBaixaTitol.setText(TDSLanguageUtils.getMessage("jpProveidor.lblDataBaixa.setText"));

        jLabelElectronica.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelElectronica.setText(TDSLanguageUtils.getMessage("jpProveidor.adressaElectronica.setText"));
        jLabelElectronica.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        txtElectronica.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtElectronica.setHorizontalAlignment(javax.swing.JTextField.LEFT);
        txtElectronica.setMinimumSize(new java.awt.Dimension(0, 30));
        txtElectronica.setPreferredSize(new java.awt.Dimension(0, 30));

        cmdPrimer2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/botoImprimir.png"))); // NOI18N
        cmdPrimer2.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdImprimir.setToolTipText"));
        cmdPrimer2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdPrimer2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pProveidorLayout = new javax.swing.GroupLayout(pProveidor);
        pProveidor.setLayout(pProveidorLayout);
        pProveidorLayout.setHorizontalGroup(
            pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pProveidorLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(pProveidorLayout.createSequentialGroup()
                        .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lblCodi, javax.swing.GroupLayout.PREFERRED_SIZE, 103, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGroup(pProveidorLayout.createSequentialGroup()
                                .addComponent(txtCodi, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(cmdPrimer2, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, 0)
                        .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(lblDataBaixaTitol, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(lblDataTitol, javax.swing.GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblDataBaixa)
                            .addComponent(lblDataAlta, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                    .addComponent(jLabelNomComercial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(txtElectronica, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(pProveidorLayout.createSequentialGroup()
                        .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(pProveidorLayout.createSequentialGroup()
                                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtPoblacio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(txtProvincia, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabelPoblacio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabelProvincia, javax.swing.GroupLayout.DEFAULT_SIZE, 189, Short.MAX_VALUE))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(txtPais, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(txtCodiPostal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addComponent(jLabelCodiPostal, javax.swing.GroupLayout.DEFAULT_SIZE, 124, Short.MAX_VALUE)
                                    .addComponent(jLabelPais, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                            .addComponent(txtDireccio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtNomComercial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtNomFiscal, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabelCIF, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jLabelNomFiscal, javax.swing.GroupLayout.DEFAULT_SIZE, 323, Short.MAX_VALUE)
                            .addComponent(jLabelDireccio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(txtNif, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(0, 19, Short.MAX_VALUE))
                    .addGroup(pProveidorLayout.createSequentialGroup()
                        .addComponent(jLabelElectronica, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())))
        );
        pProveidorLayout.setVerticalGroup(
            pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pProveidorLayout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pProveidorLayout.createSequentialGroup()
                        .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pProveidorLayout.createSequentialGroup()
                                .addComponent(lblCodi)
                                .addGap(0, 0, 0)
                                .addComponent(txtCodi, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pProveidorLayout.createSequentialGroup()
                                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblDataTitol)
                                    .addComponent(lblDataAlta))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                    .addComponent(lblDataBaixaTitol)
                                    .addComponent(lblDataBaixa))))
                        .addComponent(jLabelCIF))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pProveidorLayout.createSequentialGroup()
                        .addComponent(cmdPrimer2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))
                .addComponent(txtNif, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jLabelNomFiscal)
                .addGap(0, 0, 0)
                .addComponent(txtNomFiscal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jLabelNomComercial)
                .addGap(0, 0, 0)
                .addComponent(txtNomComercial, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(jLabelDireccio)
                .addGap(0, 0, 0)
                .addComponent(txtDireccio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelPoblacio)
                    .addComponent(jLabelCodiPostal))
                .addGap(0, 0, 0)
                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtPoblacio, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtCodiPostal, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 0, 0)
                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabelProvincia)
                    .addComponent(jLabelPais))
                .addGap(0, 0, 0)
                .addGroup(pProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtProvincia, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 0, 0)
                .addComponent(jLabelElectronica)
                .addGap(0, 0, 0)
                .addComponent(txtElectronica, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        pDadesComptables.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(TDSLanguageUtils.getMessage("jpProveidor.PanelDadesComptables.setText"))));

        jLabelTipusIva.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelTipusIva.setText(TDSLanguageUtils.getMessage("jpProveidor.lblTipusIva.setText"));
        jLabelTipusIva.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        cbIva.setMinimumSize(new java.awt.Dimension(0, 30));
        cbIva.setPreferredSize(new java.awt.Dimension(0, 30));

        jLabelPagament.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelPagament.setText(TDSLanguageUtils.getMessage("jpProveidor.LblTipusPagament.setText"));
        jLabelPagament.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        cbTipusPagament.setMinimumSize(new java.awt.Dimension(0, 30));
        cbTipusPagament.setPreferredSize(new java.awt.Dimension(0, 30));

        txtIban2.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtIban2.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtIban2.setMinimumSize(new java.awt.Dimension(0, 30));
        txtIban2.setPreferredSize(new java.awt.Dimension(0, 30));

        txtIban3.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtIban3.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtIban3.setMinimumSize(new java.awt.Dimension(0, 30));
        txtIban3.setPreferredSize(new java.awt.Dimension(0, 30));

        txtIban4.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtIban4.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtIban4.setMinimumSize(new java.awt.Dimension(0, 30));
        txtIban4.setPreferredSize(new java.awt.Dimension(0, 30));

        txtIban5.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtIban5.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtIban5.setMinimumSize(new java.awt.Dimension(0, 30));
        txtIban5.setPreferredSize(new java.awt.Dimension(0, 30));
        txtIban5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                Performed(evt);
            }
        });

        jLabelIban.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        jLabelIban.setText(TDSLanguageUtils.getMessage("jpProveidor.lblIban.setText"));
        jLabelIban.setVerticalAlignment(javax.swing.SwingConstants.TOP);

        txtIban1.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtIban1.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtIban1.setMinimumSize(new java.awt.Dimension(0, 30));
        txtIban1.setPreferredSize(new java.awt.Dimension(0, 30));

        txtIban6.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        txtIban6.setHorizontalAlignment(javax.swing.JTextField.CENTER);
        txtIban6.setMinimumSize(new java.awt.Dimension(0, 30));
        txtIban6.setPreferredSize(new java.awt.Dimension(0, 30));

        javax.swing.GroupLayout pDadesComptablesLayout = new javax.swing.GroupLayout(pDadesComptables);
        pDadesComptables.setLayout(pDadesComptablesLayout);
        pDadesComptablesLayout.setHorizontalGroup(
            pDadesComptablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pDadesComptablesLayout.createSequentialGroup()
                .addGap(9, 9, 9)
                .addGroup(pDadesComptablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(cbTipusPagament, 0, 299, Short.MAX_VALUE)
                    .addComponent(cbIva, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 44, Short.MAX_VALUE))
            .addGroup(pDadesComptablesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(pDadesComptablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabelTipusIva, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelPagament, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabelIban, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(pDadesComptablesLayout.createSequentialGroup()
                        .addComponent(txtIban1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(txtIban2, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(txtIban3, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(txtIban4, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(txtIban5, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, 0)
                        .addComponent(txtIban6, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        pDadesComptablesLayout.setVerticalGroup(
            pDadesComptablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pDadesComptablesLayout.createSequentialGroup()
                .addGap(1, 1, 1)
                .addComponent(jLabelTipusIva)
                .addGap(0, 0, 0)
                .addComponent(cbIva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(3, 3, 3)
                .addComponent(jLabelPagament)
                .addGap(0, 0, 0)
                .addComponent(cbTipusPagament, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabelIban)
                .addGap(0, 0, 0)
                .addGroup(pDadesComptablesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtIban2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtIban3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtIban4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtIban5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtIban1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtIban6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(0, 0, 0))
        );

        pNotificacio.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(""), TDSLanguageUtils.getMessage("jpProveidor.PanelNotificacions.setText")));

        javax.swing.GroupLayout pNotificacioLayout = new javax.swing.GroupLayout(pNotificacio);
        pNotificacio.setLayout(pNotificacioLayout);
        pNotificacioLayout.setHorizontalGroup(
            pNotificacioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(spNotificacions)
        );
        pNotificacioLayout.setVerticalGroup(
            pNotificacioLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(spNotificacions)
        );

        pCentre.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(TDSLanguageUtils.getMessage("jpProveidor.PanelCentres.setText"))));

        javax.swing.GroupLayout pCentreLayout = new javax.swing.GroupLayout(pCentre);
        pCentre.setLayout(pCentreLayout);
        pCentreLayout.setHorizontalGroup(
            pCentreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(spCentres)
            .addComponent(spContactes)
        );
        pCentreLayout.setVerticalGroup(
            pCentreLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pCentreLayout.createSequentialGroup()
                .addComponent(spCentres, javax.swing.GroupLayout.PREFERRED_SIZE, 169, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(spContactes))
        );

        tbNou.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoNou.png"))); // NOI18N
        tbNou.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdNou.setToolTipText"));
        tbNou.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbNouActionPerformed(evt);
            }
        });

        tbEditar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoModificar.png"))); // NOI18N
        tbEditar.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdEditar.setToolTipText"));
        tbEditar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbEditarActionPerformed(evt);
            }
        });

        cmdGuardar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoGuardar.png"))); // NOI18N
        cmdGuardar.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdGuardar.setToolTipText"));
        cmdGuardar.setFocusable(false);
        cmdGuardar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cmdGuardar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        cmdGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdGuardarActionPerformed(evt);
            }
        });

        cmdEliminar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoBorrar.png"))); // NOI18N
        cmdEliminar.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdEliminar.setToolTipText"));
        cmdEliminar.setFocusable(false);
        cmdEliminar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cmdEliminar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        cmdEliminar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdEliminarActionPerformed(evt);
            }
        });

        cmdPrimer.setFont(new java.awt.Font("Symbol", 1, 14)); // NOI18N
        cmdPrimer.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/control_double_left.png"))); // NOI18N
        cmdPrimer.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdPrimer.setToolTipText"));
        cmdPrimer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdPrimerActionPerformed(evt);
            }
        });

        cmdAnterior.setFont(new java.awt.Font("Symbol", 1, 14)); // NOI18N
        cmdAnterior.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/control_left.png"))); // NOI18N
        cmdAnterior.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdAnterior.setToolTipText"));
        cmdAnterior.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdAnteriorActionPerformed(evt);
            }
        });

        cbIndex.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cbIndexActionPerformed(evt);
            }
        });

        cmdUltim.setFont(new java.awt.Font("Symbol", 1, 14)); // NOI18N
        cmdUltim.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/control_double_right.png"))); // NOI18N
        cmdUltim.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdUltim.setToolTipText"));
        cmdUltim.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdUltimActionPerformed(evt);
            }
        });

        cmdSeguent.setFont(new java.awt.Font("Symbol", 1, 14)); // NOI18N
        cmdSeguent.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/control_right.png"))); // NOI18N
        cmdSeguent.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdSeguent.setToolTipText"));
        cmdSeguent.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdSeguentActionPerformed(evt);
            }
        });

        cmdFiltrar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoFiltrar.png"))); // NOI18N
        cmdFiltrar.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdFiltrar.setToolTipText"));
        cmdFiltrar.setFocusable(false);
        cmdFiltrar.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cmdFiltrar.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        cmdFiltrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdFiltrarActionPerformed(evt);
            }
        });

        tbCercar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/BotoCercar.png"))); // NOI18N
        tbCercar.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdCercar.setToolTipText"));
        tbCercar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tbCercarActionPerformed(evt);
            }
        });

        lblEstat.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
        lblEstat.setForeground(java.awt.SystemColor.activeCaption);
        lblEstat.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblEstat.setText("ESTAT:");

        cmdEstat.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N
        cmdEstat.setText("ACTIVAR");
        cmdEstat.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdEstatActionPerformed(evt);
            }
        });

        lblCaptionEstat.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        lblCaptionEstat.setText(TDSLanguageUtils.getMessage("jpProveidor.lblCaptionEstat.setText"));

        javax.swing.GroupLayout pEstatProveidorLayout = new javax.swing.GroupLayout(pEstatProveidor);
        pEstatProveidor.setLayout(pEstatProveidorLayout);
        pEstatProveidorLayout.setHorizontalGroup(
            pEstatProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pEstatProveidorLayout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(lblCaptionEstat, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(lblEstat, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cmdEstat, javax.swing.GroupLayout.PREFERRED_SIZE, 98, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0))
        );
        pEstatProveidorLayout.setVerticalGroup(
            pEstatProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pEstatProveidorLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(lblEstat, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE)
                .addComponent(cmdEstat, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addComponent(lblCaptionEstat, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        cmdImprimirTots.setIcon(new javax.swing.ImageIcon(getClass().getResource("/comandaXM/images/botoImprimir.png"))); // NOI18N
        cmdImprimirTots.setToolTipText(TDSLanguageUtils.getMessage("jpProveidor.cmdImprimir.setToolTipText"));
        cmdImprimirTots.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmdImprimirTotsActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout pMenuLayout = new javax.swing.GroupLayout(pMenu);
        pMenu.setLayout(pMenuLayout);
        pMenuLayout.setHorizontalGroup(
            pMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pMenuLayout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addComponent(tbNou, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tbEditar, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(cmdGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(cmdEliminar, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(tbCercar, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(cmdFiltrar, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cmdImprimirTots, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(cmdPrimer, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(cmdAnterior, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(cbIndex, javax.swing.GroupLayout.PREFERRED_SIZE, 247, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(cmdSeguent, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addComponent(cmdUltim, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(pEstatProveidor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        pMenuLayout.setVerticalGroup(
            pMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pEstatProveidor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addGroup(pMenuLayout.createSequentialGroup()
                .addGroup(pMenuLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(tbEditar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cmdSeguent, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(cbIndex, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(cmdAnterior, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(cmdPrimer, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(cmdEliminar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cmdGuardar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tbNou, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cmdFiltrar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(tbCercar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(cmdUltim, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                    .addComponent(cmdImprimirTots, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 0, Short.MAX_VALUE))
        );

        lblAccio.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblAccio.setForeground(java.awt.Color.red);
        lblAccio.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);

        lblObjecte.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblObjecte.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);

        lblError.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        lblError.setForeground(java.awt.Color.red);
        lblError.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

        javax.swing.GroupLayout pEstatLayout = new javax.swing.GroupLayout(pEstat);
        pEstat.setLayout(pEstatLayout);
        pEstatLayout.setHorizontalGroup(
            pEstatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, pEstatLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblObjecte, javax.swing.GroupLayout.PREFERRED_SIZE, 361, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblError, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(lblAccio, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0))
        );
        pEstatLayout.setVerticalGroup(
            pEstatLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(lblAccio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(lblObjecte, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
            .addComponent(lblError, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(0, 0, 0)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(pMenu, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addContainerGap())
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addComponent(pEstat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addComponent(pDadesComptables, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(pProveidor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                        .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(pCentre, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(pNotificacio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(pMenu, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 0, 0)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pProveidor, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pCentre, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(0, 0, 0)
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pDadesComptables, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(pNotificacio, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(6, 6, 6)
                .addComponent(pEstat, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jScrollPane1.setViewportView(jPanel1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1)
                .addGap(0, 0, 0))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 613, Short.MAX_VALUE)
                .addGap(0, 0, 0))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void txtNomFiscalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomFiscalActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtNomFiscalActionPerformed

    private void Performed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_Performed
        // TODO add your handling code here:
    }//GEN-LAST:event_Performed

    private void tbNouActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbNouActionPerformed
        if(tbNou.isSelected()){
            this.proveidorActual= new Proveidor() ;
            setProveidor();
            this.accio=1;
            setAction() ;
        }else{
            moureIndexProveidor();
            this.accio=0;
            setAction() ;
        }
    }//GEN-LAST:event_tbNouActionPerformed

    private void tbEditarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbEditarActionPerformed
        if(tbEditar.isSelected()){
            this.accio=1;
            setAction();
        }else{
            moureIndexProveidor();
        }

    }//GEN-LAST:event_tbEditarActionPerformed

    private void cmdGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdGuardarActionPerformed
       if (!setErrors()){           
            this.getProveidor();
            try {

                if (this.proveidorActual.getId()<=0) {
                    this.txtCodi.setText(String.valueOf(this.proveidorAct.add(proveidorActual)));
                    this.proveidors.add(proveidorActual);
                    this.cbIndex.setModel(new ComboBoxModelXM(proveidors));
                    this.cbIndex.setSelectedItem(proveidorActual);
                    this.moureIndexProveidor();
                    setAction();
                    optionPane.setOperationInsert();
                }else{
                    this.proveidorAct.update(proveidorActual);
                    optionPane.setOperationSave();
                }
                setErrors();
                
            } catch (ExceptionHibernate ex) {
                optionPane.errMessagge(ex.getMessage());
                this.lblAccio.setText(ex.getMessage());

            }
        }
    }//GEN-LAST:event_cmdGuardarActionPerformed

    private void cmdEliminarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdEliminarActionPerformed
        if(optionPane.ConfirmRemove()){
            try {
                this.proveidorAct.remove(proveidorActual);
                this.proveidors.remove(this.proveidorActual);
                //this.cbIndex.setModel(new ComboBoxModelXM());
                if(this.cbIndex.getItemCount()>0 ){
                    this.cbIndex.setSelectedIndex(0);
                    this.moureIndexProveidor();
                }else{
                    this.tbCercar.setSelected(true);
                    this.activarCercador();
                }
                setAction();
            } catch (ExceptionHibernate ex) {
                optionPane.errMessagge(ex.getMessage());
            }

        }
    }//GEN-LAST:event_cmdEliminarActionPerformed

    private void cmdPrimerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdPrimerActionPerformed
        this.saveFormat();
        cbIndex.setSelectedIndex(0);
        moureIndexProveidor();

    }//GEN-LAST:event_cmdPrimerActionPerformed

    private void cmdAnteriorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdAnteriorActionPerformed
        this.saveFormat();
        cbIndex.setSelectedIndex(cbIndex.getSelectedIndex()-1);
        moureIndexProveidor();

    }//GEN-LAST:event_cmdAnteriorActionPerformed

    private void cbIndexActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbIndexActionPerformed
        if(cbIndex.getSelectedIndex()>-1 ){
            this.saveFormat();
            this.proveidorActual= (Proveidor)cbIndex.getSelectedItem();
            
            this.setProveidor();
        }
        moureIndexProveidor();

    }//GEN-LAST:event_cbIndexActionPerformed

    private void cmdUltimActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdUltimActionPerformed
        this.saveFormat();
        cbIndex.setSelectedIndex(cbIndex.getItemCount()-1);
        moureIndexProveidor();

    }//GEN-LAST:event_cmdUltimActionPerformed

    private void cmdSeguentActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdSeguentActionPerformed
        this.saveFormat();
        cbIndex.setSelectedIndex(cbIndex.getSelectedIndex()+1);
        moureIndexProveidor();

    }//GEN-LAST:event_cmdSeguentActionPerformed
    private void saveFormat(){        
            try{
                this.centres.saveFormat();
            }catch(NullPointerException e){System.out.println("Exception.SaveFormatCentre");}           
            try{
                this.contactes.saveFormat();
            }catch(NullPointerException e){System.out.println("Exception.SaveFormatContactes");     }            
            try{
                this.notificacions.saveFormat();
            }catch(NullPointerException e){System.out.println("Exception.SaveFormatNotificacions");     }        
    }
    private void cmdFiltrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdFiltrarActionPerformed

        try {
            this.proveidors= proveidorAct.getProveidors(txtCodi.getText(),txtNif.getText(), txtNomFiscal.getText(),txtNomComercial.getText(),txtDireccio.getText(), txtPoblacio.getText(), txtCodiPostal.getText(),(Provincia)this.autoCompleterProvincia.getSelectedItem(),(Pais)this.autoCompleterPais.getSelectedItem());
            cbIndex.setModel(new ComboBoxModelXM(proveidors));
            if (cbIndex.getItemCount()>0 ){
                setFiltres(); 
                
                cbIndex.setSelectedIndex(0);
                moureIndexProveidor();
                this.tbCercar.setSelected(false);
                this.accio=2;
                setAction();
            }else{

                if(optionPane.ConfirmMessage(TDSLanguageUtils.getMessage("jPProveidor.noTROBAT.setText"))) {
                    this.proveidorActual= new Proveidor() ;
                    getProveidor(); 
                    setProveidor();
                    this.accio=1;
                    setAction() ;
                }

            }

        } catch (ExceptionHibernate ex) {
            Logger.getLogger(JPProveidor.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_cmdFiltrarActionPerformed

    private void tbCercarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tbCercarActionPerformed
        if(tbCercar.isSelected()){
            activarCercador();
            this.resetControls();
        }else{
            moureIndexProveidor();
            this.cmdFiltrar.setEnabled(false);
            this.accio=2;
            setAction();
        }
    }//GEN-LAST:event_tbCercarActionPerformed

    private void cmdEstatActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdEstatActionPerformed
        try {
            if (this.proveidorActual.isActiu()){
                if (optionPane.ConfirmDownOperation()){
                    this.proveidorActual.setActiu(false);
                    this.proveidorActual.setDataBaixa(new Date() );
                    this.lblEstat.setText(TDSLanguageUtils.getMessage("lblEstat.noActiu.setText"));
                    this.cmdEstat.setText(TDSLanguageUtils.getMessage("cmdEstat.activar.setText"));
                    this.accio=2;
                    this.proveidorAct.update(this.proveidorActual);
                    this.moureIndexProveidor();
                    this.setAction();
                }

            }else{
                if (optionPane.ConfirmUpOperation()){
                    this.proveidorActual.setActiu(true);
                    this.lblEstat.setText(TDSLanguageUtils.getMessage("lblEstat.Actiu.setText"));
                    this.cmdEstat.setText(TDSLanguageUtils.getMessage("cmdEstat.bloquejar.setText"));
                    this.proveidorActual.setDataBaixa(null);
                    this.proveidorAct.update(this.proveidorActual);
                    this.moureIndexProveidor();
                    this.setAction();
                }
            }

        } catch (ExceptionHibernate ex) {
            optionPane.errMessagge(ex.getMessage());
        }
    }//GEN-LAST:event_cmdEstatActionPerformed

    private void cmdImprimirTotsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdImprimirTotsActionPerformed
       
        JasperReport reporte;  
        JasperPrint jasperPrint;
        Map <String,String>parameters = new HashMap<String,String>(); 
        parameters.put("Filtre", "FiltreInforme"); 
       Dtproveidors datasource = new Dtproveidors();  
       datasource.setProveidors(proveidors);
         
        datasource.setProveidors(proveidors);
        try {
            reporte = (JasperReport) JRLoader.loadObject(Utils.pathInformes()+"/proveidor/ReportProveidors.jasper");
            jasperPrint = JasperFillManager.fillReport(reporte,(Map) parameters, datasource);
            
            
            JasperViewer.viewReport( jasperPrint, false);
        } catch (JRException ex) {
            Logger.getLogger(JPProveidor.class.getName()).log(Level.SEVERE, null, ex);
        }
         
        
        
    }//GEN-LAST:event_cmdImprimirTotsActionPerformed

    private void cmdPrimer2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmdPrimer2ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_cmdPrimer2ActionPerformed
private void activarCercador(){
            this.proveidorActual= new Proveidor(); 
            setProveidor();             
            this.cmdFiltrar.setEnabled(true);
            this.cbIndex.setModel(new ComboBoxModelXM() );
            this.moureIndexProveidor();
            this.accio=0; 
            setAction();
    }
    
    private void moureIndexProveidor( )
    {        
        cmdPrimer.setEnabled(true);
        cmdAnterior.setEnabled(true);
        cmdSeguent.setEnabled(true);
        cmdUltim.setEnabled(true); 
        if(cbIndex.getItemCount()<=1){
            cmdPrimer.setEnabled(false);
            cmdAnterior.setEnabled(false);
            cmdSeguent.setEnabled(false);
            cmdUltim.setEnabled(false);
        }
        else if(cbIndex.getSelectedIndex()<=0){
            cmdPrimer.setEnabled(false);
            cmdAnterior.setEnabled(false);
        }else if(cbIndex.getSelectedIndex()>=cbIndex.getItemCount()-1){
            cmdSeguent.setEnabled(false);
            cmdUltim.setEnabled(false); 
        }
        this.cbIndex.repaint();
        this.cbIva.repaint();
        this.cbTipusPagament.repaint();
        this.accio=2; 
        setAction();              
        this.lblError.setText("(" + (cbIndex.getSelectedIndex()+1) + TDSLanguageUtils.getMessage("lblComptador.etqDe.setText") + cbIndex.getItemCount() +")" );
        if (!this.proveidorActual.isActiu() ) {
            this.lblError.setText("(" + (cbIndex.getSelectedIndex()+1) + TDSLanguageUtils.getMessage("lblComptador.etqDe.setText") + cbIndex.getItemCount() +"). "+ TDSLanguageUtils.getMessage("lblEstat.avis.bloquejat.setText") );
        }else{
            this.lblError.setText("(" + (cbIndex.getSelectedIndex()+1) + TDSLanguageUtils.getMessage("lblComptador.etqDe.setText") + cbIndex.getItemCount() +")" );
        }
        this.resetControls(); 
    }
    private void setColor(Color c){
        this.pProveidor.setBackground(c);
        this.pCentre.setBackground(c);
        this.pNotificacio.setBackground(c);
        this.pDadesComptables.setBackground(c);
    }
    private void setColorBackground(Color c){
        this.txtNif.setBackground(c);
        this.txtNomFiscal.setBackground(c);            
        this.txtDireccio.setBackground(c);
        this.txtPoblacio.setBackground(c);
        this.txtProvincia.setBackground(c);
        this.txtPais.setBackground(c);
        this.txtCodiPostal.setBackground(c);
        
    }
    private void setPanelsVisible(boolean estat ) {
        this.pCentre.setVisible(estat);
        this.pNotificacio.setVisible(estat);
        this.pEstatProveidor.setVisible(estat);
        this.pDadesComptables.setVisible(estat);
        this.jLabelElectronica.setVisible(estat);
        this.txtElectronica.setVisible(estat);
        this.lblObjecte.setVisible(estat);
        this.lblError.setVisible(estat);
        this.lblDataTitol.setVisible(estat);
        this.lblDataBaixaTitol.setVisible(estat);
        this.lblDataAlta.setVisible(estat); 
        this.lblDataAlta.setVisible(estat);
    }
    
    private void setAction() {
        if(this.accio==0){//cerca                
            this.txtCodi.setEnabled(true);
            this.txtCodi.setOpaque(true);
            this.txtNif.setEnabled(true);            
            this.txtNif.requestFocus();
            this.txtNif.select(0, 9);
            this.txtNomFiscal.setEnabled(true);        
            this.txtNomComercial.setEnabled(true);
            this.txtDireccio.setEnabled(true);           
            this.txtPoblacio.setEnabled(true);            
            this.txtProvincia.setEnabled(true);            
            this.txtPais.setEnabled(true);
            this.txtCodiPostal.setEnabled(true);            
            this.txtElectronica.setEnabled(false);
            this.cbIva.setEnabled(false);
            this.cbTipusPagament.setEnabled(false);
            this.txtIban1.setEnabled(false);
            this.txtIban2.setEnabled(false);
            this.txtIban3.setEnabled(false);
            this.txtIban4.setEnabled(false);
            this.txtIban5.setEnabled(false);
            this.txtIban6.setEnabled(false);            
            this.lblAccio.setText(TDSLanguageUtils.getMessage("lblEstat.modeCercador.setText"));            
            this.cmdEstat.setEnabled(false);
            this.tbNou.setEnabled(false);
            this.tbNou.setSelected(true);
            this.tbEditar.setEnabled(false);
            this.tbEditar.setSelected(false);
            this.cmdGuardar.setEnabled(false);
            this.cmdEliminar.setEnabled(false);
            this.cmdFiltrar.setEnabled(true);
            setColor(pEstat.getBackground());
            setColorBackground(Utils.getColorControlLectura()); 
            this.cbIndex.setEnabled(false);
            this.lblError.setText("");
            this.setPanelsVisible(false); 
            
            
            
        }else if (this.accio==1){//edicio
            this.txtCodi.setOpaque(false);
            this.txtNif.setEnabled(true); 
            this.txtNif.requestFocus();
            this.txtNif.select(0, 9);
            this.txtCodi.setEnabled(false);            
            this.txtNomFiscal.setEnabled(true);            
            this.txtNomComercial.setEnabled(true);
            this.txtDireccio.setEnabled(true);            
            this.txtPoblacio.setEnabled(true);            
            this.txtProvincia.setEnabled(true);            
            this.txtPais.setEnabled(true);            
            this.txtCodiPostal.setEnabled(true);                        
            this.txtElectronica.setEnabled(true);
            this.cbIva.setEnabled(true);
            this.cbTipusPagament.setEnabled(true);
            this.txtIban1.setEnabled(true);
            this.txtIban2.setEnabled(true);
            this.txtIban3.setEnabled(true);
            this.txtIban4.setEnabled(true);
            this.txtIban5.setEnabled(true);
            this.txtIban6.setEnabled(true);    
            this.cmdGuardar.setEnabled(true);
            if (this.proveidorActual.getId()<=0){
                this.lblAccio.setText(TDSLanguageUtils.getMessage("lblEstat.modeInsercio.setText"));
                this.lblObjecte.setText(TDSLanguageUtils.getMessage("jpProveidor.lblEstat.nouRegistre.setText"));
                
                this.cmdEliminar.setEnabled(false);
                setColor(Utils.getColorNou()); 
                this.tbEditar.setEnabled(false);
            }else{
                this.lblAccio.setText(TDSLanguageUtils.getMessage("lblEstat.modeEdicio.setText"));
                this.lblObjecte.setText(this.proveidorActual.toString());
                this.cmdEstat.setEnabled(true);
                this.cmdEliminar.setEnabled(true);
                setColor(Utils.getColorEdicio());
            }
            setColorBackground(Utils.getColorControlEdicio()); 
            this.tbNou.setEnabled(true);
            this.tbCercar.setSelected(false);
            this.cmdFiltrar.setEnabled(false);
            this.cbIndex.setEnabled(true);                        
            this.setPanelsVisible(true); 
            try{
                this.centres.setEnabled(true);            
                this.notificacions.setEnabled(true);
                this.contactes.setEnabled(true);
            }catch (NullPointerException e){
                
            }            
            
        }else if (accio==2){//nomes visible
            this.txtCodi.setEnabled(false);
            this.txtCodi.setOpaque(false);
            this.txtNif.setEnabled(false);
            this.txtNomFiscal.setEnabled(false);            
            this.txtNomComercial.setEnabled(false);
            this.txtDireccio.setEnabled(false);
            this.txtPoblacio.setEnabled(false);
            this.txtProvincia.setEnabled(false);
            this.txtPais.setEnabled(false);
            this.txtCodiPostal.setEnabled(false);        
            this.txtElectronica.setEnabled(false);
            this.cbIva.setEnabled(false);
            this.cbTipusPagament.setEnabled(false);
            this.txtIban1.setEnabled(false);
            this.txtIban2.setEnabled(false);
            this.txtIban3.setEnabled(false);
            this.txtIban4.setEnabled(false);
            this.txtIban5.setEnabled(false);
            this.txtIban6.setEnabled(false);            
            this.lblAccio.setText(TDSLanguageUtils.getMessage("lblEstat.modeLEctura.setText"));
            this.lblObjecte.setText(this.proveidorActual.toString());
            
            this.cmdGuardar.setEnabled(false);
            this.cmdEliminar.setEnabled(false);
            this.tbNou.setEnabled(true);
            this.tbNou.setSelected(false); 
            if (this.proveidorActual.isActiu()) {
                this.tbEditar.setEnabled(true);
                this.cmdEstat.setEnabled(false);
            }else{
                this.tbEditar.setEnabled(false);
                this.cmdEstat.setEnabled(true);
            }
            this.tbCercar.setSelected(false);
            this.tbEditar.setSelected(false); 
            this.cmdFiltrar.setEnabled(false);
            setColor(pEstat.getBackground());
            setColorBackground(Utils.getColorControlLectura()); 
            this.cbIndex.setEnabled(true);            
            setPanelsVisible(true); 
            try{
                this.centres.setEnabled(false);            
                this.notificacions.setEnabled(false);
                this.contactes.setEnabled(false);
            }catch (NullPointerException e){
                
            }
            
        }
        
    }
    @Override
    public String toString () {
        return "JPProveidor"; 
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JComboBox cbIndex;
    private javax.swing.JComboBox cbIva;
    private javax.swing.JComboBox cbTipusPagament;
    private javax.swing.JButton cmdAnterior;
    private javax.swing.JButton cmdEliminar;
    private javax.swing.JButton cmdEstat;
    private javax.swing.JButton cmdFiltrar;
    private javax.swing.JButton cmdGuardar;
    private javax.swing.JButton cmdImprimirTots;
    private javax.swing.JButton cmdPrimer;
    private javax.swing.JButton cmdPrimer2;
    private javax.swing.JButton cmdSeguent;
    private javax.swing.JButton cmdUltim;
    private javax.swing.JLabel jLabelCIF;
    private javax.swing.JLabel jLabelCodiPostal;
    private javax.swing.JLabel jLabelDireccio;
    private javax.swing.JLabel jLabelElectronica;
    private javax.swing.JLabel jLabelIban;
    private javax.swing.JLabel jLabelNomComercial;
    private javax.swing.JLabel jLabelNomFiscal;
    private javax.swing.JLabel jLabelPagament;
    private javax.swing.JLabel jLabelPais;
    private javax.swing.JLabel jLabelPoblacio;
    private javax.swing.JLabel jLabelProvincia;
    private javax.swing.JLabel jLabelTipusIva;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel lblAccio;
    private javax.swing.JLabel lblCaptionEstat;
    private javax.swing.JLabel lblCodi;
    private javax.swing.JLabel lblDataAlta;
    private javax.swing.JLabel lblDataBaixa;
    private javax.swing.JLabel lblDataBaixaTitol;
    private javax.swing.JLabel lblDataTitol;
    private javax.swing.JLabel lblError;
    private javax.swing.JLabel lblEstat;
    private javax.swing.JLabel lblObjecte;
    private javax.swing.JPanel pCentre;
    private javax.swing.JPanel pDadesComptables;
    private javax.swing.JPanel pEstat;
    private javax.swing.JPanel pEstatProveidor;
    private javax.swing.JPanel pMenu;
    private javax.swing.JPanel pNotificacio;
    private javax.swing.JPanel pProveidor;
    private javax.swing.JScrollPane spCentres;
    private javax.swing.JScrollPane spContactes;
    private javax.swing.JScrollPane spNotificacions;
    private javax.swing.JToggleButton tbCercar;
    private javax.swing.JToggleButton tbEditar;
    private javax.swing.JToggleButton tbNou;
    private javax.swing.JTextField txtCodi;
    private javax.swing.JTextField txtCodiPostal;
    private javax.swing.JTextField txtDireccio;
    private javax.swing.JTextField txtElectronica;
    private javax.swing.JTextField txtIban1;
    private javax.swing.JTextField txtIban2;
    private javax.swing.JTextField txtIban3;
    private javax.swing.JTextField txtIban4;
    private javax.swing.JTextField txtIban5;
    private javax.swing.JTextField txtIban6;
    private javax.swing.JTextField txtNif;
    private javax.swing.JTextField txtNomComercial;
    private javax.swing.JTextField txtNomFiscal;
    private javax.swing.JTextField txtPais;
    private javax.swing.JTextField txtPoblacio;
    private javax.swing.JTextField txtProvincia;
    // End of variables declaration//GEN-END:variables
}
